#pragma once
#include "Piece.h"
#include "Vector.hpp"

// the board class will hold all of the pieces that have currently been placed on the game board
// it will hold these in a Vector container, and be responsible for validating player moves

const int ciBoardWidth = 14;
const int ciBoardHeight = 14;

class Board : public Drawable
{
private:
	int xMin, xMax, zMin, zMax;

public:
	Vector<Piece*> vPieces;
	Vec3D v3P1Start, v3P2Start;
	int BoardSlots[ciBoardHeight][ciBoardWidth];	// the internal game board, showing each slot on the gameboard

	Board();
	bool Init(int type, int owner, Vec3D pos);
	void CreateWorldTransform(D3DXMATRIX &matWorld);
	void Rotate(int direction);
	void findEmptySpot(Piece thePiece, int tilesToCheck, int &x, int &z);
	bool isValidSpot(Piece* pieceInQuestion);	
	bool isOutOfBounds(Piece* pieceInQuestion);
	void WorldCoordToArrayIndex(int & x, int & z);
	bool placePiece(Piece* toBePlaced);
	void Cleanup();
	~Board() { Cleanup(); }
};